@extends('master')

@section('content')

      <div class="row-fluid">
          <div class="span3">
            <div class="title">
                  <div class="row-fluid legend">
                      <h3><i class="fa fa-retweet"></i> 物品入库流程
                      </h3>
                  </div>
              </div><!-- End .title -->
              <div class="content">
                  <ul class="nav nav-tabs nav-stacked">
                    @foreach($nodes as $node)
                    <li><a href="javascript:void(0);">{{ $node->step }} {{ $node->des }}</a></li>
                    @endforeach


                  </ul>
              </div> <!-- End .content -->
          </div><!-- End .span3 -->

        <div class="span9">
          <div class="row-fluid legend profile">
            <div class="row-fluid ">
              <div class="span6">
                <h3><i class="fa fa-paper-plane-o"></i> 操作区</h3>

              </div>
              <div class="span6">
                <div class=" pull-right">
                    <a class="btn" href="javascript:history.go(-1)" >
                    <i class="fa fa-hand-o-left"></i> 返回
                    </a>
                  </div>
             </div>
            </div>
          </div> <!-- End .legend -->

              <div class="content spacer-big">
                <h3><span>① 发起【{{ $process->des }}】</span> <small>单</small></h3>


                <table class="table table-bordered">
                <thead>
                  <tr>
                  <th>物品名称</th><th>价格</th><th>数量</th>
                  @if($process->template->unit_type == 0)<th>供应商</th>@endif
                  </tr>
                </thead>
                <tbody>
                @foreach($records as $record)
                <tr>
                <td>{{ $record->commodity->name }}</td><td>{{ $record->price }}</td><td>{{ $record->count }}</td>
                  @if($process->template->unit_type == 0)<td>{{ $record->remark }}</td>@endif

                </tr>
                @endforeach
                </tbody>
                </table>
                <hr class="border_das">
                <div class="form-row control-group row-fluid">
                  {{--<div class="controls span1">--}}
                      {{--<img src="img/logo_avatar.gif" class="img-thumbnail">--}}
                  {{--</div>--}}
                  <div class="controls span10">
                    <blockquote>
                      <p><b>备注：</b> 暂无</p>
                      <small  class="red">{{ $process->user->unit->name }} {{ $process->user->name }} 发起于 {{ $process->created_at }}</small>
                    </blockquote>
                  </div>
                </div>

                @foreach($threads as $key => $thread)

                    @if($key > 0)


                <hr>
                <h3>{{ $thread->step }} {{ $thread->des }} <small></small></h3>
                <div class="form-row control-group row-fluid">
                  <div class="controls span10">
                    <blockquote>
                      <p><b>备注：</b> {{ $thread->remark }}</p>
                      <small>{{ $thread->user->unit->name }} {{ $thread->user->name }} 于 {{ $thread->updated_at }}</small>
                    </blockquote>
                  </div>
                </div>


                    @endif

                @endforeach




                    <hr>

                {!! Form::model($process, array('route' => array('flows.updated', $process->id),'class' => 'form-horizontal')) !!}
                {{--{!! Form::model($process, array('route' => array('flows.update', $process->id)), 'class' => 'form-horizontal', 'id' => '', 'role' => 'form') !!}--}}
                    <h3>{{ $this_thread->step }} {{ $this_thread->node->des }} <small>等待本人操作</small></h3>
                    <!-- 说明开始 -->
                      <div class="form-row control-group row-fluid">
                        <div class="controls span6">
                          <textarea rows="3" class="row-fluid autogrow" id="elastic-textarea" placeholder="请备注相关情况，驳回或中止务必填写理由.."></textarea>
                        </div>
                      </div>
                <!-- 说明结束 -->
                  <div class="form-actions row-fluid">
                    <div class="text-center">

                    {!! Form::submit('通过', ['class' => 'btn btn-primary','name'=> 'action']) !!}
                    {!! Form::submit('驳回', ['class' => 'btn btn-inverse','name'=> 'action']) !!}
                    {!! Form::submit('中止', ['class' => 'btn btn-secondary','name'=> 'action']) !!}
                      {{--<a class="btn btn-primary" data-toggle="modal" data-target="#confirm_alert"><i class="fa fa-step-forward"></i> 通过</a>--}}
                      {{--<a class="btn btn-inverse" data-toggle="modal" data-target="#confirm_alert"><i class="fa fa-fast-backward"></i> 驳回</a>--}}
                      {{--<a class="btn btn-secondary" data-toggle="modal" data-target="#confirm_alert"><i class="fa fa-stop"></i> 中止</a>--}}
                    </div>
                  </div>

            {!! Form::close() !!}
              </div> <!-- End .content -->
          </div><!-- End .span9 -->
      </div><!-- End .row-fluid -->









@stop

@section('script')

<script type='text/javascript'>
    $(window).load(function() {
     $('#loading').fadeOut();
    });
      $(document).ready(function() {
      $('body').css('display', 'no`');
      $('body').fadeIn(500);


      $("#logo a, #sidebar_menu a:not(.accordion-toggle), a.ajx").click(function() {
      event.preventDefault();
      newLocation = this.href;
      $('body').fadeOut(500, newpage);
      });
      function newpage() {
      window.location = newLocation;
      };


      $(".add").click(function(){
          // 复制一行
          var count = $('#count').val();
          var new_count = Number(count)+1;
          $('#count').val(new_count);
          var content = "<div class='controls span2 del'><a class='btn btn-inverse del' ><i class='fa  fa-trash'></i></a></div>" ;
          $(this).parent().clone(true).appendTo("#my");
          // 去掉这项
          $("#my .control-group:last-child .add").remove();
          $("#my .control-group:last-child").append(content);
          $("#my .control-group:last-child .com-name").attr("id","input_"+new_count);
          $("#my .control-group:last-child .com-id").attr("id","commodity__"+new_count);
          $("#my .control-group:last-child").find("input").val("");
      });
      $(".del").live('click',function(){
          $(this).closest(".control-group").remove();
      });





    });
    </script>
@stop